<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员登录 - 少儿编程</title>
    <!-- Bootstrap CSS -->
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            height: 100vh;
            display: flex;
            align-items: center;
            background: linear-gradient(135deg, #1e90ff, #70a1ff);
        }
        .form-signin {
            width: 100%;
            max-width: 400px;
            padding: 30px;
            margin: auto;
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
        }
        .form-signin h1 {
            color: #1e90ff;
            margin-bottom: 30px;
        }
        .form-signin .form-floating {
            margin-bottom: 15px;
        }
        .form-signin .form-control {
            height: 50px;
            border-radius: 25px;
            padding-left: 20px;
            padding-right: 20px;
        }
        .form-signin .form-control:focus {
            border-color: #1e90ff;
            box-shadow: 0 0 0 0.2rem rgba(30,144,255,0.25);
        }
        .form-signin .btn-primary {
            height: 50px;
            border-radius: 25px;
            font-size: 1.1rem;
            background-color: #1e90ff;
            border-color: #1e90ff;
            margin-top: 20px;
        }
        .form-signin .btn-primary:hover {
            background-color: #187bcd;
            border-color: #187bcd;
        }
        .back-link {
            color: white;
            text-decoration: none;
            position: fixed;
            top: 20px;
            left: 20px;
            padding: 10px 20px;
            border-radius: 20px;
            background: rgba(255,255,255,0.2);
            backdrop-filter: blur(5px);
            transition: all 0.3s ease;
        }
        .back-link:hover {
            background: rgba(255,255,255,0.3);
            color: white;
        }
    </style>
</head>
<body>
    <a href="{{ url_for('home.index') }}" class="back-link">
        <i class="fas fa-arrow-left"></i> 返回首页
    </a>
    
    <main class="form-signin">
        <form method="post">
            <h1 class="text-center">管理员登录</h1>
            
            {% with messages = get_flashed_messages(with_categories=true) %}
                {% if messages %}
                    {% for category, message in messages %}
                        <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                            {{ message }}
                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                    {% endfor %}
                {% endif %}
            {% endwith %}

            <div class="form-floating">
                <input type="text" class="form-control" id="username" name="username" placeholder="用户名" required>
                <label for="username">用户名</label>
            </div>
            <div class="form-floating">
                <input type="password" class="form-control" id="password" name="password" placeholder="密码" required>
                <label for="password">密码</label>
            </div>

            <button class="w-100 btn btn-primary" type="submit">登录</button>
        </form>
    </main>

    <!-- Bootstrap JS -->
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.2.3/js/bootstrap.bundle.min.js"></script>
    <!-- jQuery -->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
</body>
</html>
